<?Lassoscript 
// Last modified 3/8/10 by ECL, Landmann InterActive

// FUNCTIONALITY
// Previews a template - This page is a derivative of detail.lasso

// CHANGE NOTES
// 3/8/10
// First implementation

// Debugging
// Var('svDebug' = 'Y');

// Robot check
Include(($svBaseHelpersPath)+'robotcheck.inc');

// Start the Admin session
// Session_Start(-Name=$svSessionAdminName, -Expires=$svSessionTimeout);

'<!-- preview -->\n';

// Login check
// DISABLING THIS as it does not allow proper template viewing
// If: (Var:'svUser_ID') != '';

	// Build the Page Content Variables
	Include(($svBaseHelpersPath)+'build_detail.inc');
	
	// Build Navigation
	Include(($svBaseHelpersPath)+'build_nav.inc');
	
	// Build Dropdowns
	Include(($svBaseHelpersPath)+'build_dropdown.inc');
	
	// Build Gallery
	// This check for zero is necessary because the default value is zero on GalleryGroupID
	If((Var('vGalleryGroupID') != '') && (Var('vGalleryGroupID') != '0'));
		Include(($svBaseHelpersPath)+'build_gallery.inc');
	/If;
	
	// Build the Portfolio - Do not include on Quicksearch pages
	If(Var('SearchType') != 'QS');
		Include(($svBaseHelpersPath)+'build_portfolio.inc');
	/If;
	
	// Build the Footer
	Include(($svBaseHelpersPath)+'build_footer.inc');

	// Call the Header
	Include(($svBaseHelpersPath)+'page_header.inc');

	// Call the Template
	// Check to see if template exists. If it does not, set error 5061 "file not found" and redirect
	Var('TemplateExists' = File_Exists(($svTmpltsPath)+($svSys_DefaultTemplate)));
	If($TemplateExists == true);
		Include(($svTmpltsPath)+($svSys_DefaultTemplate));
	Else;
		// Set error to 5061 "File not found", redirect to library
		Var('vError' = '5061');
		LI_URLRedirect(-Page=(($svAdminControllersPath)+($svLibraryPage)),-UseError='Y',-Error=$vError, -UseArgs='Y');
	/If;

/*
Else;

	// Set error to 6003 "Session Expired", redirect to login
	Var('vError' = '6003');
	LI_URLRedirect(-Page=$svLoginPage,-UseError='Y',-Error=$vError);

/If;
*/
?>
